package com.google.project.client.Admin;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.project.client.Sharing.CreateMessage;
import com.google.project.client.Sharing.MessageDetail;
import com.google.project.client.Sharing.MessageList;
import com.google.project.shared.MessageDTO;




public class ADMEntrypoint implements EntryPoint {

	interface ConnectrAppUiBinder extends UiBinder<DockLayoutPanel, ADMEntrypoint> {
	}
//	private final AdmServiceAsync admService = GWT.create(AdmServiceAsync.class);
	private static final ConnectrAppUiBinder binder = GWT.create(ConnectrAppUiBinder.class);
	private static ADMEntrypoint singleton;

	
	// @formatter:off
//	@UiField HeaderPanel headerPanel;
	@UiField ScrollPanel mainPanel;

	// @formatter:on

	RootLayoutPanel root;

	/** Gets the singleton application instance. */
	public static ADMEntrypoint get() {
		return singleton;
	}

	@Override
	public void onModuleLoad() {
		singleton = this;
		DockLayoutPanel outer = binder.createAndBindUi(this);
		root = RootLayoutPanel.get();
		root.add(outer);
		mainPanel.add(new ADMHomepage());
	}
	public void cancelEditFriend() {
		clearMainPanel();	
	}

	public void clearMainPanel() {
		mainPanel.clear();
	}
   public void ADMProjectList(){
	   clearMainPanel();
	   mainPanel.add(new ADMProjectList());
	   
   }
   public void ADMCreateProjectList(){
	   clearMainPanel();
	   mainPanel.add(new ADMCreateProject());
   }
   public void ADMEditProject(String projectId){
	   clearMainPanel();
	   mainPanel.add(new ADMCreateProject(projectId));
   }
   public void ADMAccountList(){
	   clearMainPanel();
	   mainPanel.add(new ADMAccountList());
   }
   public void ADMCreateAccount(){
	   clearMainPanel();
	   mainPanel.add(new ADMCreateAccount());
   }
   public void ADMCreateAccount(String userId){
	   clearMainPanel();
	   mainPanel.add(new ADMCreateAccount(userId));
   }
   public void ADMCreateMessage(){
		clearMainPanel();
		mainPanel.add(new CreateMessage());
	}
	public void ADMMessList(){
		clearMainPanel();
		mainPanel.add(new MessageList());
	}
	public void ADMMessDetail(MessageDTO mess){
		clearMainPanel();
		mainPanel.add(new MessageDetail(mess));
	}

	public void ADMHomepage() {
		clearMainPanel();
		mainPanel.add(new ADMHomepage());
	}

	public void ADMProjectList(int status) {
		clearMainPanel();
		mainPanel.add(new ADMProjectList(status));
	}

	public void ADMAccountList(int status) {
		clearMainPanel();
		mainPanel.add(new ADMAccountList(status));
	}

}
